1 /*
2 
3 Boost Software License - Version 1.0 - August 17th, 2003
4 
5 Permission is hereby granted, free of charge, to any person or organization
6 obtaining a copy of the software and accompanying documentation covered by
7 this license (the "Software") to use, reproduce, display, distribute,
8 execute, and transmit the Software, and to prepare derivative works of the
9 Software, and to permit third-parties to whom the Software is furnished to
10 do so, all subject to the following:
11 
12 The copyright notices in the Software and this entire statement, including
13 the above license grant, this restriction and the following disclaimer,
14 must be included in all copies of the Software, in whole or in part, and
15 all derivative works of the Software, unless such copies or derivative
16 works are solely in the form of machine-executable object code generated by
17 a source language processor.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 DEALINGS IN THE SOFTWARE.
26 
27 */ 
28 
29 module derelict.purple.proxy;
30 
31 import derelict.glib.gtypes;
32 import derelict.glib.glibconfig;
33 import derelict.purple.account;
34 extern (C):
35 
36 alias _Anonymous_0 PurpleProxyType;
37 alias _Anonymous_1 PurpleProxyInfo;
38 alias _PurpleProxyConnectData PurpleProxyConnectData;
39 alias void function (void*, int, const(char)*) PurpleProxyConnectFunction;
40 
41 enum _Anonymous_0
42 {
43 	PURPLE_PROXY_USE_GLOBAL = -1,
44 	PURPLE_PROXY_NONE = 0,
45 	PURPLE_PROXY_HTTP = 1,
46 	PURPLE_PROXY_SOCKS4 = 2,
47 	PURPLE_PROXY_SOCKS5 = 3,
48 	PURPLE_PROXY_USE_ENVVAR = 4,
49 	PURPLE_PROXY_TOR = 5
50 }
51 
52 struct _Anonymous_1
53 {
54 	PurpleProxyType type;
55 	char* host;
56 	int port;
57 	char* username;
58 	char* password;
59 }
60 
61 struct _PurpleProxyConnectData;
62 
63 version(Derelict_Link_Static)
64 {
65     extern( C ) nothrow 
66     {
67 	    PurpleProxyInfo* purple_proxy_info_new();
68         void purple_proxy_info_destroy(PurpleProxyInfo* info);
69         void purple_proxy_info_set_type(PurpleProxyInfo* info, PurpleProxyType type);
70         void purple_proxy_info_set_host(PurpleProxyInfo* info, const(char)* host);
71         void purple_proxy_info_set_port(PurpleProxyInfo* info, int port);
72         void purple_proxy_info_set_username(PurpleProxyInfo* info, const(char)* username);
73         void purple_proxy_info_set_password(PurpleProxyInfo* info, const(char)* password);
74         PurpleProxyType purple_proxy_info_get_type(const(PurpleProxyInfo)* info);
75         const(char)* purple_proxy_info_get_host(const(PurpleProxyInfo)* info);
76         int purple_proxy_info_get_port(const(PurpleProxyInfo)* info);
77         const(char)* purple_proxy_info_get_username(const(PurpleProxyInfo)* info);
78         const(char)* purple_proxy_info_get_password(const(PurpleProxyInfo)* info);
79         PurpleProxyInfo* purple_global_proxy_get_info();
80         void purple_global_proxy_set_info(PurpleProxyInfo* info);
81         void* purple_proxy_get_handle();
82         void purple_proxy_init();
83         void purple_proxy_uninit();
84         PurpleProxyInfo* purple_proxy_get_setup(PurpleAccount* account);
85         PurpleProxyConnectData* purple_proxy_connect(void* handle, PurpleAccount* account, const(char)* host, int port, PurpleProxyConnectFunction connect_cb, gpointer data);
86         PurpleProxyConnectData* purple_proxy_connect_udp(void* handle, PurpleAccount* account, const(char)* host, int port, PurpleProxyConnectFunction connect_cb, gpointer data);
87         PurpleProxyConnectData* purple_proxy_connect_socks5_account(void* handle, PurpleAccount* account, PurpleProxyInfo* gpi, const(char)* host, int port, PurpleProxyConnectFunction connect_cb, gpointer data);
88         PurpleProxyConnectData* purple_proxy_connect_socks5(void* handle, PurpleProxyInfo* gpi, const(char)* host, int port, PurpleProxyConnectFunction connect_cb, gpointer data);
89         void purple_proxy_connect_cancel(PurpleProxyConnectData* connect_data);
90         void purple_proxy_connect_cancel_with_handle(void* handle);
91     }
92 }
93 else
94 {
95     extern( C ) nothrow 
96     {
97 	    alias da_purple_proxy_info_new = PurpleProxyInfo* function();																																											
98         alias da_purple_proxy_info_destroy = void function(PurpleProxyInfo* info);																																								
99         alias da_purple_proxy_info_set_type = void function(PurpleProxyInfo* info, PurpleProxyType type);																																		
100         alias da_purple_proxy_info_set_host = void function(PurpleProxyInfo* info, const(char)* host);																																			
101         alias da_purple_proxy_info_set_port = void function(PurpleProxyInfo* info, int port);																																					
102         alias da_purple_proxy_info_set_username = void function(PurpleProxyInfo* info, const(char)* username);																																	
103         alias da_purple_proxy_info_set_password = void function(PurpleProxyInfo* info, const(char)* password);																																	
104         alias da_purple_proxy_info_get_type = PurpleProxyType function(const(PurpleProxyInfo)* info);																																			
105         alias da_purple_proxy_info_get_host = const(char)* function(const(PurpleProxyInfo)* info);																																				
106         alias da_purple_proxy_info_get_port = int function(const(PurpleProxyInfo)* info);																																						
107         alias da_purple_proxy_info_get_username = const(char)* function(const(PurpleProxyInfo)* info);																																			
108         alias da_purple_proxy_info_get_password = const(char)* function(const(PurpleProxyInfo)* info);																																			
109         alias da_purple_global_proxy_get_info = PurpleProxyInfo* function();																																									
110         alias da_purple_global_proxy_set_info = void function(PurpleProxyInfo* info);																																							
111         alias da_purple_proxy_get_handle = void* function();																																													
112         alias da_purple_proxy_init = void function();																																															
113         alias da_purple_proxy_uninit = void function();																																															
114         alias da_purple_proxy_get_setup = PurpleProxyInfo* function(PurpleAccount* account);																																					
115         alias da_purple_proxy_connect = PurpleProxyConnectData* function(void* handle, PurpleAccount* account, const(char)* host, int port, PurpleProxyConnectFunction connect_cb, gpointer data);												
116         alias da_purple_proxy_connect_udp = PurpleProxyConnectData* function(void* handle, PurpleAccount* account, const(char)* host, int port, PurpleProxyConnectFunction connect_cb, gpointer data);											
117         alias da_purple_proxy_connect_socks5_account = PurpleProxyConnectData* function(void* handle, PurpleAccount* account, PurpleProxyInfo* gpi, const(char)* host, int port, PurpleProxyConnectFunction connect_cb, gpointer data);			
118         alias da_purple_proxy_connect_socks5 = PurpleProxyConnectData* function(void* handle, PurpleProxyInfo* gpi, const(char)* host, int port, PurpleProxyConnectFunction connect_cb, gpointer data);											
119         alias da_purple_proxy_connect_cancel = void function(PurpleProxyConnectData* connect_data);																																				
120         alias da_purple_proxy_connect_cancel_with_handle = void function(void* handle);	
121     }
122 
123     __gshared
124     {
125 	    da_purple_proxy_info_new purple_proxy_info_new;
126 	    da_purple_proxy_info_destroy purple_proxy_info_destroy;
127 	    da_purple_proxy_info_set_type purple_proxy_info_set_type;
128 	    da_purple_proxy_info_set_host purple_proxy_info_set_host;
129 	    da_purple_proxy_info_set_port purple_proxy_info_set_port;
130 	    da_purple_proxy_info_set_username purple_proxy_info_set_username;
131 	    da_purple_proxy_info_set_password purple_proxy_info_set_password;
132 	    da_purple_proxy_info_get_type purple_proxy_info_get_type;
133 	    da_purple_proxy_info_get_host purple_proxy_info_get_host;
134 	    da_purple_proxy_info_get_port purple_proxy_info_get_port;
135 	    da_purple_proxy_info_get_username purple_proxy_info_get_username;
136 	    da_purple_proxy_info_get_password purple_proxy_info_get_password;
137 	    da_purple_global_proxy_get_info purple_global_proxy_get_info;
138 	    da_purple_global_proxy_set_info purple_global_proxy_set_info;
139 	    da_purple_proxy_get_handle purple_proxy_get_handle;
140 	    da_purple_proxy_init purple_proxy_init;
141 	    da_purple_proxy_uninit purple_proxy_uninit;
142 	    da_purple_proxy_get_setup purple_proxy_get_setup;
143 	    da_purple_proxy_connect purple_proxy_connect;
144 	    da_purple_proxy_connect_udp purple_proxy_connect_udp;
145 	    da_purple_proxy_connect_socks5_account purple_proxy_connect_socks5_account;
146 	    da_purple_proxy_connect_socks5 purple_proxy_connect_socks5;
147 	    da_purple_proxy_connect_cancel purple_proxy_connect_cancel;
148 	    da_purple_proxy_connect_cancel_with_handle purple_proxy_connect_cancel_with_handle;
149     }
150 }